// import { deleteJob, listJob} from "../apis/job";
import axios from "axios";


//
//  function getJob(id) {
//     return axios.get('/api/job/'+id)
// }


//  function updateJob(id,data) {
//     // parent_job_id
//     // title
//     // content
//     return axios.get('/api/job/'+id, data);
// }


export function createJob({dispatch}, {title, content, parentJobId}) {
    axios.post('/api/job', {title: title, content: content, parentJobId: parentJobId})
        .then(function (response) {
            dispatch('listJobs')
        });
}

export function listJobs({commit}) {
    axios.get('/api/job', {})
        .then(function (response) {
            commit('jobs', response.data.data)
        });
}

export function delJobs({commit, dispatch}, item) {
    axios.delete('/api/job/' + item.id)
        .then(function (response) {
            dispatch('listJobs')
        });
}